home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 19 / Mac Magazin and MacEasy Magazine CD - Issue 19.iso / Wissenschaft & Technik / chipmunk-basic-321 ƒ / sieve.bas < prev    next >
BASIC Source File  |  1994-03-23  |  432b  |  22 lines

  1. 10 rem sieve 6/1/92 test
  2. 20 loops = 1
  3. 30 t = timer
  4. 40 dim f(8194)
  5. 50 for j = 1 to loops
  6. 60 c = 0
  7. 70 s = 8191
  8. 80 for i = 0 to s : f(i) = 1 : next i
  9. 90 for i = 0 to s
  10. 100   if f(i) = 0 then goto 140
  11. 110   p = i+i+3
  12. 115   if i+p > s then 130
  13. 120   for k = i+p to s step p : f(k) = 0 : next k
  14. 130   c = c+1
  15. 140 next i
  16. 150 next j
  17. 160 print c;" primes found ";
  18. 170 t = timer-t
  19. 180 print loops;" times in ";
  20. 190 print t;" seconds"
  21. 200 end
  22.